; *** Solitaire, Square  ...and other solitaire puzzles
; *** Copyright 1998-2002 Zillions Development
; v.2.0

; You need to purchase Zillions of Games to load this rules file
; Visit the Zillions web site at http://www.zillions-of-games.com
(translate
 ("6x6 Solitaire" "6x6标准")
 ("6x6 Marked Man Solitaire" "6x6蓝球")
 ("3x8 Marked Man Solitaire" "3x8蓝球")
 ("8x8 Checkers Solitaire" "8x8双色")
 ("8x8 Diagonal Solitaire" "8x8对角")
)

(define jump ($1 (verify not-empty?) capture $1 (verify empty?) add))
(define jump-green ($1 (verify (piece? Green)) capture $1 (verify empty?) add))

(game
    (title "6x6 Solitaire")
    (solution "Solutions\Solitaire,_Square\6x6_Square.zsg")
    (description "横向或纵向跳过一个棋子吃掉它。\\
       本关目标：剩下一个棋子")
    (history "For further information on this game see: The Unexpected
       Hanging and Other Mathematical Diversions, by Martin Gardner.
       University of Chicago Press, 1991.   The optimal solution to this
       problem, a 16-move solution (a series of consecutive jumps by one
       marble counts as one move) with an 8-sweep (8 marbles jumped on
       the last move), was first discovered in 1962 by John W. Harris.")
    (strategy "Avoid leaving a single marble all by itself on an edge or
       corner.\\A comprehensive book on all kinds of peg solitaire is
       John D. Beasley's `The Ins and Outs of Peg Solitaire`.\\
       To see the solution, select `Show Solution` under the Help menu.")
    (option "prevent flipping" 2)
    (move-sound "")
    (capture-sound "Audio\\Clack.wav")
    (players Player)
    (turn-order Player)
    (board
        (image "images\Solitaire\6x6bd.bmp")
        (grid
            (start-rectangle 6 6 36 36) ; top-left position
            (dimensions ;6x6
                ("a/b/c/d/e/f" (38 0)) ; columns
                ("6/5/4/3/2/1" (0 38)) ; rows
			)
			(directions (n 0 -1) (e 1 0) (s 0 1) (w -1 0))
		)
	)
    (piece
        (name Blue)
		(help "横向或纵向跳过一个相邻子并吃掉之。")
		(description "蓝球\横向或纵向跳过一个相邻子并吃掉之。")
        (image Player "images\Solitaire\Marble.bmp")
		(moves (jump n) (jump e) (jump s) (jump w))			
	)
    (piece
        (name Green)
		(help "横向或纵向跳过一个相邻子并吃掉之。")
 		(description "绿球\横向或纵向跳过一个相邻子并吃掉之。.")
        (image Player "images\Solitaire\GreenMarble.bmp")
		(moves (jump n) (jump e) (jump s) (jump w))			
	)
            
    (board-setup
        (Player (Green
                b6 c6 d6 e6 f6
             a5 b5 c5 d5 e5 f5
             a4 b4 c4 d4 e4 f4
             a3 b3 c3 d3 e3 f3
             a2 b2 c2 d2 e2 f2
             a1 b1 c1 d1 e1 f1
		   )
		)
	)
    (win-condition (Player)(pieces-remaining 1 Green))
    (loss-condition (Player) stalemated)
)

(variant
    (title "6x6 Marked Man Solitaire")
    (solution "Solutions\Solitaire,_Square\6x6_Marked.zsg")
    (description "横向或纵向跳过一个棋子吃掉它。\\
       本关目标：只剩下蓝色棋子")
    (history "Problems with a designated marble to be left at the end are
       called `marked man` problems.   In this case, the blue marble can
       also be `a man on the watch`, in which case it should not be moved
       until the end of the game, when it should remove all of the other
       remaining marbles (and as many as possible) in one series of jumps.\\
       The `man on the watch` problem was originated by C. Bizalion in about
       1870, and extensively studied by Ernest Bergholt in his 1920 book
       on peg solitaire.   Wade E. Philpott and Harry O. Davis analyzed
       the problem on the 6x6 board.   See John D. Beasley's `The Ins and
       Outs of Peg Solitaire` for more details.   The Philpott-Davis solution
       shown comes from his book, and ends with the `man on the watch`
       jumping ten marbles on the last move.")
    (board-setup
        (Player (Green
             a6 b6    d6 e6 f6
             a5 b5 c5 d5 e5 f5
                b4 c4 d4 e4 f4
             a3 b3 c3 d3 e3 f3
             a2 b2 c2 d2 e2 f2
             a1 b1 c1 d1 e1 f1
		   )
		   (Blue a4)
		)
	)
    (piece
        (name Green)
		(help "横向或纵向跳过一个相邻子并吃掉之。只能吃绿球")
 		(description "Green Marble\Jumps up, down, left, or right over an adjacent
		   green marble onto an empty square beyond.  The marble jumped over is captured.")
        (image Player "images\Solitaire\GreenMarble.bmp")
		(moves (jump-green n) (jump-green e) (jump-green s) (jump-green w))			
	)
    (win-condition (Player) (pieces-remaining 0 Green))
    (loss-condition (Player) stalemated)
)


(variant
    (title "3x8 Marked Man Solitaire")
    (solution "Solutions\Solitaire,_Square\3x8.zsg")
    (description "横向或纵向跳过一个棋子吃掉它。\\
       本关目标：只剩下蓝色棋子")
    (history "This game was described by puzzle king, Henry Ernest Dudeney, in the
	   early 1900's.")
    (strategy "To see the solution, select `Show Solution` under the Help menu.")
    (players Player)
    (turn-order Player)
    (board
        (image "images\Solitaire\3x8bd.bmp")
        (grid
            (start-rectangle 6 6 36 36) ; top-left position
            (dimensions
                ("a/b/c/d/e/f/g/h" (38 0)) ; columns
                ("3/2/1" (0 38)) ; rows
			)
			(directions (n 0 -1) (e 1 0) (s 0 1) (w -1 0))
		)
	)         
    (board-setup
        (Player (Blue  a1)
		        (Green b1 c1 d1 e1 f1 g1 h1 a2 b2 c2 d2 e2 f2 g2 h2)
		)
	)
    (piece
        (name Green)
		(help "横向或纵向跳过一个相邻子并吃掉之。只能吃绿球")
 		(description "Green Marble\Jumps up, down, left, or right over an adjacent
		   green marble onto an empty square beyond.  The marble jumped over is captured.")
        (image Player "images\Solitaire\GreenMarble.bmp")
		(moves (jump-green n) (jump-green e) (jump-green s) (jump-green w))			
	)
    (win-condition (Player) (pieces-remaining 0 Green))
    (loss-condition (Player) stalemated)
)

(variant
    (title "8x8 Checkers Solitaire")
    (solution "Solutions\Solitaire,_Square\8x8_Checkers.zsg")
    (description "横向或纵向跳过一个棋子吃掉它。\\
       本关目标：剩下两个同色棋子")
    (history "")
    (strategy "To see the solution, select `Show Solution` under the Help menu.")
    (players Player)
    (turn-order Player)
    (board
        (image "images\Solitaire\8x8bd.bmp")
        (grid
            (start-rectangle 6 6 36 36) ; top-left position
            (dimensions
                ("a/b/c/d/e/f/g/h" (38 0)) ; columns
                ("8/7/6/5/4/3/2/1" (0 38)) ; rows
			)
			(directions (n 0 -1) (e 1 0) (s 0 1) (w -1 0))
		)
	)         
    (board-setup
        (Player (Blue  a8 b8 c8 d8 e8 f8 g8 h8 a7 b7 c7 d7 e7 f7 g7 h7)
		        (Green a2 b2 c2 d2 e2 f2 g2 h2 a1 b1 c1 d1 e1 f1 g1 h1)
		)
	)
    (win-condition (Player) (and (pieces-remaining 2 Blue) (pieces-remaining 0 Green)))
    (win-condition (Player) (and (pieces-remaining 0 Blue) (pieces-remaining 2 Green)))
    (loss-condition (Player) stalemated)
)

(variant
    (title "8x8 Diagonal Solitaire")
    (solution "Solutions\Solitaire,_Square\8x8_Diagonal.zsg")
    (description "斜向跳过一个棋子吃掉它。\\
       本关目标：剩下最少的蓝色棋子。\
      达成剩9-18个比较简单，剩4-8个稍难一些。最少的能达成数量是4个。")
    (history "This puzzle appeared in Filipiak's `Mathematical Puzzles
	   and Other Brain Twisters` [1942], so it has been around for some
	   time.  It is a cross between normal Solitaire and Checkers.")
    (strategy "Try to maneuver marbles into a corner or edge of the board.\\If
	   the board were checkered, it would be easy to see that
	   marbles only interact with other marbles on the same square color.  Thus
	   this puzzle can be thought of as two instances of the identical problem:
	   to reduce all the marbles of the same square color.  To see a solution,
	   which solves one color and then symmetrically solves the other,
	   select `Show Solution` under the Help menu.")
    (players Player)
    (turn-order Player)
    (board
        (image "images\Solitaire\8x8bd.bmp")
        (grid
            (start-rectangle 6 6 36 36) ; top-left position
            (dimensions
                ("a/b/c/d/e/f/g/h" (38 0)) ; columns
                ("8/7/6/5/4/3/2/1" (0 38)) ; rows
			)
			(directions (ne 1 -1) (se 1 1) (nw -1 -1) (sw -1 1))
		)
	)
    (piece
        (name Blue)
		(help "斜向跳过一个棋子吃掉它。")
 		(description "Blue Marble\Jumps diagonally over an adjacent
		   marble onto an empty square beyond.  The marble jumped over is captured.")
        (image Player "images\Solitaire\Marble.bmp")
		(moves (jump ne) (jump se) (jump nw) (jump sw))			
	)
    (piece (name Green)) ; none
    (board-setup
        (Player (Blue  a8 b8 c8 d8 e8 f8 g8 h8 a7 b7 c7 d7 e7 f7 g7 h7
		               a2 b2 c2 d2 e2 f2 g2 h2 a1 b1 c1 d1 e1 f1 g1 h1
					   a3 a4 a5 a6 b3 b4 b5 b6 g3 g4 g5 g6 h3 h4 h5 h6
				)
		)
	)
    (win-condition (Player)(pieces-remaining 4 Blue))
    (loss-condition (Player) stalemated)
)

